<?php
namespace Home\Controller;
use Think\Controller;
class AccountController extends BaseController {

   
   public function xf_jifen()
    { 

      $userid=session('user.id');
      $user=M('user')->find($userid);
      $map['jifen_type']='xf';
      $map['user_id']=$userid;
      $records=M('jifen_record')->where($map)->select();
      $total=M('jifen_record')->where($map)->count();
      $this->assign('records',$records);
      $this->assign('total',$total);
      $this->assign('user',$user);
      $this->assign('xf_jifen',$user['xf_jifen']);
      $this->display();
    }

     public function cf_jifen()
    { 

      $userid=session('user.id');
      $user=M('user')->find($userid);
       $map['jifen_type']='cf';
      $map['user_id']=$userid;
      $records=M('jifen_record')->where($map)->select();
      $total=M('jifen_record')->where($map)->count();
      $this->assign('user',$user);
      $this->assign('total',$total);
      $this->assign('records',$records);
      $this->assign('cf_jifen',$user['cf_jifen']);
      $this->display();
    }
    //积分转让
    public function zr_jifen()
    { 

      $userid=session('user.id');
      $user=M('user')->find($userid);
      $f=M('user')->where('invite_id='.$userid)->find();
      if (!$f) {
       $this->error('您还没有邀请好友，暂时不能转让财富积分');
      }

       $map['jifen_type']='cf';
      $map['user_id']=$userid;
      $map['items']='积分转让';
      $records=M('jifen_record')->where($map)->select();
      $total=M('jifen_record')->where($map)->count();
      $this->assign('user',$user);
      $this->assign('total',$total);
      $this->assign('records',$records);
      $this->assign('cf_jifen',$user['cf_jifen']);
      $this->display();
    }

     public function cash()
    { 
      $tixian_fee=M('sys')->getField('tixian_fee');
      $tixian_explain=M('sys')->getField('tixian_explain');
      $map['user_id']=session('user.id');
      $lists=M('tixian')->where($map)->order('id desc')->select();
      $tx=M('tixian')->where($map)->order('id desc')->find();
      $this->assign('tixian_fee',$tixian_fee);
      $this->assign('tixian_explain',$tixian_explain);
      $this->assign('jifen',1);
      $this->assign('lists',$lists);
      $this->assign('tx',$tx);
      $this->display();
    }

     public function gz_reward()
    { 

      $map['user_id']=session('user.id');
      $records=M('order_gz')->where($map)->select();
      $this->assign('records',$records);
      $this->display();
    }


}
